package timetable.webservice;

import java.util.List;

import timetable.io.SQLDatabase;
import timetable.io.TimeTableEntry;


public class DataLayerWebService {

	public DataLayerWebService()
	{
		
	}
	
	public static TimeTableEntry[] getRecordsByDocent(String docent, String dag)
	{
		SQLDatabase db = new SQLDatabase("com.mysql.jdbc.Driver", "jdbc:mysql://127.0.0.1:3306/Rooster", "root", "vis-tik", "timetable");
		List<TimeTableEntry> records = db.getRecordsByDocent(docent, dag);
		
		return records.toArray(new TimeTableEntry[0]);
	}
	
	public static TimeTableEntry[] getErrors()
	{
		SQLDatabase db = new SQLDatabase("com.mysql.jdbc.Driver", "jdbc:mysql://127.0.0.1:3306/Rooster", "root", "vis-tik", "timetable");
		List<TimeTableEntry> records = db.getErrors();
		
		return records.toArray(new TimeTableEntry[0]);
	}
	/*public ArrayList<String> getRecordsByKlas(String klas, String dag)
	{
		ArrayList<String> result = new ArrayList<String>();
		
		List<TimeTableEntry> records = db.getRecordsByDocent(klas, dag);
		
		for (TimeTableEntry e : records) 
		{
			result.add(e.toString());
		}
		
		return result;
	}
	
	public ArrayList<String> getRecordsByVak(String vak, String dag)
	{
		ArrayList<String> result = new ArrayList<String>();
		
		List<TimeTableEntry> records = db.getRecordsByDocent(vak, dag);
		
		for (TimeTableEntry e : records) 
		{
			result.add(e.toString());
		}
		
		return result;
	}*/
	
	/*public static void main(String[] args)
	{
		String[] d = new DataLayerWebService().getRecordsByDocent("test", "donderdag");
		for (String s: d)
		{
			System.out.println(s);
		}
	}*/
}
